#include <iostream>
#include <set>
#include <map>
#include <utility>
using namespace std;

void test0(){
    set<int> number = {1, 2, 3, 4, 5, 6, 7};
    pair<set<int>::iterator, bool> ret = number.insert(8);
    if(ret.second){
        cout << "该元素插入成功:"
            << *(ret.first) << endl;
    }else{
        cout << "该元素插入失败，表明该元素已存在" << endl;
    }

    int arr[5] = {18,41,35,2,99};
    number.insert(arr, arr + 5);
    for (auto elem : number){
        cout << elem << " ";
    }
    cout << endl;
}

void test1(){
    map<int,string> number1 = {
        {1,"hello"},
        {2,"world"},
        {3,"wangdao"},
        pair<int,string>(4,"hubei"),
        pair<int,string>(5,"wangdao"),
        make_pair(6,"shenzhen"),
        make_pair(7,"beijing"),
        make_pair(8,"shanghai")
    }; 

    for(auto elem : number1){
        cout << elem.first << " ";
    }
    cout << endl;

    for(auto it = number1.begin(); it != number1.end(); it++){
        cout << it->first << " " << (*it).second << " ";
    }
    cout << endl;
}


int main(void){
    test1();
    return 0;
}

